package com.twu.biblioteca;

import com.twu.biblioteca.items.Book;
import com.twu.biblioteca.items.Movie;
import com.twu.biblioteca.items.Rating;
import com.twu.biblioteca.library.Library;
import com.twu.biblioteca.ui.BibliotecaAppRunner;
import com.twu.biblioteca.ui.menus.books.ListBooksMenu;
import com.twu.biblioteca.users.User;

public class BibliotecaApp {

    public static void main(String[] args) {

        Library library = new Library();

        addBooks(library);

        addMovies(library);

        addUsers(library);

        BibliotecaAppRunner runner = new BibliotecaAppRunner(new ListBooksMenu(library));
        runner.run();
    }

    private static void addMovies(Library library) {
        Movie movie1 = new Movie("MOVIE000000001", "The Fast and the Furious", "Rob Cohen", 2001, Rating.SIX);
        Movie movie2 = new Movie("MOVIE000000002", "2 Fast 2 Furious", "John Singleton", 2003, Rating.FIVE);
        Movie movie3 = new Movie("MOVIE000000003", "The Fast and the Furious: Tokyo Drift", "Justin Lin", 2006, Rating.FIVE);
        Movie movie4 = new Movie("MOVIE000000004", "Fast & Furious", "Justin Lin", 2009, Rating.SIX);
        Movie movie5 = new Movie("MOVIE000000005", "Fast Five", "Justin Lin", 2011, Rating.SEVEN);
        Movie movie6 = new Movie("MOVIE000000006", "Fast & Furious 6", "Justin Lin", 2013, Rating.SEVEN);
        Movie movie7 = new Movie("MOVIE000000007", "Fast & Furious 7", "James Wan", 2015, Rating.UNRATED);

        library.checkoutMovie(movie1);
        library.checkoutMovie(movie2);
        library.checkoutMovie(movie3);
        library.checkoutMovie(movie4);
        library.checkoutMovie(movie5);
        library.checkoutMovie(movie6);
        library.checkoutMovie(movie7);
    }

    private static void addBooks(Library library) {
        Book book1 = new Book("ISBN000000001", "Harry Potter and the Philosopher's Stone", "J.K. Rowling");
        Book book2 = new Book("ISBN000000002", "Harry Potter and the Chamber of Secrets", "J.K. Rowling");
        Book book3 = new Book("ISBN000000003", "Harry Potter and the Prisoner of Azkaban", "J.K. Rowling");
        Book book4 = new Book("ISBN000000004", "Harry Potter and the Goblet of Fire", "J.K. Rowling");
        Book book5 = new Book("ISBN000000005", "Harry Potter and the Order of the Phoenix", "J.K. Rowling");
        Book book6 = new Book("ISBN000000006", "Harry Potter and the Half-Blood Prince", "J.K. Rowling");
        Book book7 = new Book("ISBN000000007", "Harry Potter and the Deathly Hallows", "J.K. Rowling");

        library.checkoutBook(book1);
        library.checkoutBook(book2);
        library.checkoutBook(book3);
        library.checkoutBook(book4);
        library.checkoutBook(book5);
        library.checkoutBook(book6);
        library.checkoutBook(book7);
    }

    private static void addUsers(Library library) {
        library.getUserAccountsManager().registerUser(new User("123-4567", "password", "Juan Dela Cruz", "juan.delacruz@somewhere.com", "+635089771"));
    }
}

